﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="PS_RoyalItemRequests.aspx.cs" Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.PS_RoyalItemRequests" %>

<%@ Register src="../Controls/EmployeeTypeCombo.ascx" tagname="EmployeeTypeCombo" tagprefix="uc1" %>
<%@ Register src="../Controls/MasterYear.ascx" tagname="MasterYear" tagprefix="uc2" %>
<%@ Register src="../Controls/user.ascx" tagname="user" tagprefix="uc3" %>

<asp:Content 
    ID="Content1" 
    runat="server" 
    contentplaceholderid="ContentPlaceHolder1">   
    
    <title>รายชื่อผู้มีสิทธิ์ขอรับพระราชทานเครื่องราชอิสริยาภรณ์</title>
    <link href="../../Styles/CssClass.css" rel="stylesheet" type="text/css" />
        
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">        
            <script type="text/javascript">
                function onTextChange(sender) {
                    if (sender.get_value() == "") {
                        sender.set_text("");
                    }
                }
                                
            </script>       
    </telerik:RadCodeBlock>
    
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" 
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
             <telerik:AjaxSetting AjaxControlID="cmdFilter">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" 
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="lblHeader" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmdAutoInsert">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" 
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>   

    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" 
        Height="100%" Width="75px" Transparency="50">
        <table style="height: 100%; width: 100%" border="0">
            <tr>
                <td width="100%" align="center" valign="middle">
                    <img alt="Loading..." 
                        src="../Images/Buttons/loading.gif" 
                        style="border: 0px;" />
                </td>
            </tr>
        </table>
    </telerik:RadAjaxLoadingPanel>
    <br />
    <asp:panel ID="Panel6" runat="server" >
    <table width="1000" cellpadding="0" cellspacing="0">
        <tr>
            <td width="280">
               <!-- <uc3:user ID="user1" runat="server" /> -->
            </td>
            <td width="10" >
            </td>
            <td width="700" >
                <div class="moduleDivSlim700">
                    <div class="moduleDivBottom700">
                    <asp:Panel ID="PanelFilter" runat="server" Width="700px" >
                            <table width = "680px" align ="center">
                                    <tr>
                                        <td align="right" >
                                            ประเภทบุคลากร :
                                        </td>
                                        <td>                                            
                                            <uc1:EmployeeTypeCombo ID="cbEmployeeType" runat="server" />                                            
                                        </td>
                                        <td align="right">
                                            ปีที่ขอ  :
                                        </td>
                                        <td>                                        
                                           <uc2:MasterYear ID="cbYear" runat="server" />
                                        </td>
                                        <td align="right">&nbsp;</td>
                                        <td>
                                            <asp:Button 
                                                ID="cmdFilter" runat="server" 
                                                onclick="cmdFilter_Click" 
                                                Text="กรองข้อมูล" />
                                            <asp:Button 
                                                ID="cmdAutoInsert" runat="server" 
                                                onclick="cmdFilter_Click" 
                                                Text="ตั้งต้นข้อมูลอัตโนมัติ" />
                                        </td>
                                    </tr>
                                </table>
                        </asp:Panel>    
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan ="3">
                <div class="moduleDivSlim1000">
                    <div class="moduleDivBottom1000">
                     <asp:Panel ID="Panel7" runat="server" ScrollBars="Auto" Width="1000px">
                            <table width="100%">
                                <tr>
                                    <td class="tableHeader">
                                        <asp:Label ID="lblHeader" runat="server" Font-Bold="True"></asp:Label>
                                        <telerik:RadTextBox ID="txtSearch0" Runat="server" Visible="False">
                                        </telerik:RadTextBox>
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                        <asp:Panel ID="Panel4" runat="server" Height="380px" ScrollBars="Auto" 
                            Width="1000px">
                <table align="center">
                    <tr>
                        <td>
                            <telerik:RadGrid 
                            ID="RadGrid1" 
                            runat="server" 
                            AllowAutomaticDeletes="True" 
                            AllowFilteringByColumn="True" 
                            AllowMultiRowEdit="True" 
                            AllowMultiRowSelection="True" 
                            AllowPaging="True" 
                            AllowSorting="True" 
                            AutoGenerateColumns="False" 
                            EnableAJAX="True" 
                            EnableAJAXLoadingTemplate="True" 
                            GridLines="None" 
                            OnItemCommand="RadGrid1_ItemCommand" 
                            Skin="Outlook" 
                            Width="950px">
                            <MasterTableView AllowMultiColumnSorting="True" CellSpacing="-1" 
                                ClientDataKeyNames="Sequence" 
                                CommandItemDisplay="Top" 
                                DataKeyNames="Sequence" 
                                InsertItemPageIndexAction="ShowItemOnCurrentPage" 
                                NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                                <CommandItemTemplate>
                                <table width="100%">
                                <tr>
                                    <td width = "100px">
                                        <asp:LinkButton ID="cmdAddNew" runat="server" CausesValidation="False" 
                                            CommandName="InitInsert"                                            
                                            Visible="<%# !RadGrid1.MasterTableView.IsItemInserted && RadGrid1.EditIndexes.Count <= 0 %>">
                                        <img style="border:0px;vertical-align:middle;" alt="" 
                                        src="../Images/Buttons/AddRecord.gif" /> เพิ่มรายชื่อผู้มีสิทธิ์</asp:LinkButton>
                                        &nbsp;&nbsp;
                                    </td>
                                    <td align ="left">
                                    <asp:LinkButton ID="cmdSendAll" runat="server" CommandName="SendAll" 
                                            OnClientClick="javascript:return confirm('แจ้งเวียนบุคลากรที่เลือกไว้ทั้งหมดหรือไม่?')" 
                                            Visible="<%# !RadGrid1.MasterTableView.IsItemInserted && RadGrid1.EditIndexes.Count <= 0 %>" CausesValidation="False"><img 
                                            style="border:0px;vertical-align:middle;" alt=""
                                            src="../Images/Buttons/mail_gr.gif" /> แจ้งเวียน</asp:LinkButton>
                                    </td>
                                    
                                </tr>
                            </table>
                            </CommandItemTemplate>
                                <RowIndicatorColumn>
                                    <HeaderStyle Width="20px" />
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn>
                                    <HeaderStyle Width="20px" />
                                </ExpandCollapseColumn>          
                                <Columns>
                                    <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" ItemStyle-Width="15">
                                        <ItemStyle Width="15px" />
                                    </telerik:GridClientSelectColumn>
                                    <telerik:GridEditCommandColumn 
                                        ButtonType="ImageButton" 
                                        InsertImageUrl ="../Images/Buttons/Edit.gif"
                                        EditText = "คลิกเพื่อแก้ไขรายการ" >
                                        <ItemStyle Width="15px" HorizontalAlign ="Center" />
                                    </telerik:GridEditCommandColumn>
                                    <telerik:GridButtonColumn 
                                        ButtonType="ImageButton" 
                                        CommandName="Delete" 
                                        ConfirmDialogType="RadWindow" 
                                        ConfirmText="ลบข้อมูลที่เลือก?" 
                                        Text="คลิกเพื่อลบรายการ" 
                                        UniqueName="column1">
                                        <ItemStyle Width="15px" HorizontalAlign ="Center" />
                                    </telerik:GridButtonColumn>
                                    <telerik:GridBoundColumn 
                                        DataField="RoyalItem.Name" 
                                        Display="False" 
                                        HeaderText="ชั้นตราเครื่องราชอิสริยาภรณ์" 
                                        ReadOnly="True" 
                                        UniqueName="RoyalItem.Name"
                                        Visible="False">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn 
                                        DataField="Sequence" 
                                        DataType="System.Int32" 
                                        Display="False" 
                                        HeaderText="Sequence" 
                                        ReadOnly="True" 
                                        UniqueName="Sequence" 
                                        Visible="False">
                                    </telerik:GridBoundColumn>                                    
                                    
                                    <telerik:GridTemplateColumn
                                        HeaderText = "ชื่อ - นามสกุล"
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter="true" 
                                        CurrentFilterFunction="Contains" 
                                        ShowFilterIcon="False">
                                        <HeaderStyle Width = "150px" />
                                    <ItemTemplate>
                                    <%# Eval("Employee.Person.NamePrefix.Name")%> <%# Eval("Employee.Person.FirstName")%> 
                                        &nbsp;<%#Eval("Employee.Person.LastName")%> 
                                    </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridBoundColumn 
                                        DataField="Position.RefNo" 
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="เลขที่ตำแหน่ง" 
                                        UniqueName="Position.RefNo">
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn 
                                        DataField="Position.Name" 
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="ชื่อตำแหน่ง" 
                                        UniqueName="Position.Name">
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn 
                                        DataField="Class.Name" 
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="ระดับตำแหน่ง" 
                                        UniqueName="Class.Name">
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn 
                                        DataField="JobSite.Name" 
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="สังกัด" 
                                        UniqueName="JobSite.Name">
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn 
                                        DataField="Employee.LatestClassDate" 
                                        DataFormatString ="{0:dd/MM/yyyy}"
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="ได้รับระดับปัจจุบันเมื่อวันที่" 
                                        UniqueName="Employee.LatestClassDate">
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn 
                                        DataField="Employee.AdmittedDate" 
                                        DataFormatString ="{0:dd/MM/yyyy}"
                                        FilterControlWidth = "100%"
                                        AutoPostBackOnFilter ="true"
                                        ShowFilterIcon ="false"
                                        HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="วันที่สั่งบรรจุ" 
                                        UniqueName="Employee.AdmittedDate">
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridCheckBoxColumn 
                                        DataField="Need" 
                                        HeaderStyle-HorizontalAlign="Center" 
                                        HeaderText="ขอรับ" 
                                        AllowFiltering ="false"
                                        UniqueName="Need">
                                        <HeaderStyle HorizontalAlign="Center" Width="30px" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </telerik:GridCheckBoxColumn>
                                </Columns>
                                <EditFormSettings 
                                    EditFormType="WebUserControl" 
                                    UserControlName="../UserControls/PS_RoyalItemRequests.ascx">
                                    <EditColumn UniqueName="EditCommandColumn1"></EditColumn>
                                </EditFormSettings>
                                <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                            </MasterTableView>
                            <ClientSettings AllowColumnHide="True" 
                                AllowColumnsReorder="True" 
                                EnableRowHoverStyle="True" 
                                ReorderColumnsOnClient="True">
                                <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                                </ClientSettings>
                        </telerik:RadGrid>
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>   
                        
                    </div>
                </div>
            </td>

        </tr>
        
    </table>
    </asp:panel>
    </asp:Content>
